package com.example.ordersystem.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.ordersystem.entity.Admin;
import com.example.ordersystem.mapper.AdminMapper;
import com.example.ordersystem.service.AdminService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class AdminServiceImpl extends ServiceImpl<AdminMapper, Admin>implements AdminService {
    @Resource
    AdminMapper adminMapper;
    /**
     * 管理员登录
     * @param admin 管理员对象
     * @return 是否登录成功
     */
    @Override
    public boolean login(Admin admin) {
        QueryWrapper<Admin> adminQueryWrapper=new QueryWrapper<Admin>()
                .eq("username",admin.getUsername())
                .eq("pwd",admin.getPwd());
        Admin admin1 = adminMapper.selectOne(adminQueryWrapper);
        return admin1!=null;
    }
}
